<?php
/**
 * 汇友科技
 * @copyright (c) 2017 http://www.huiyou365.net All rights reserved.
 * @author: Creatint <creatint@163.com>
 */

namespace Admin\Model;

use Common\Model\Model;

class DistrictModel extends Model {
    private $lists;

    public function getLists(){
        return $this->lists;
    }

	public function refresh() {
		$districts = $this->alias('a')->join('y_item b ON b.did=a.id and b.status>-1')->field('a.*,count(b.id) as item')->group('b.did')->select();
		foreach ($districts as $v) {
			$this->where(['id'=>$v['id']])->setField('item_num', $v['item']);
		}

	}
}
